export default function () {
  // #ifdef APP-PLUS
  return new Promise((resolve, reject) => {
    // 根据当前应用的appid，获取appid对应的应用信息
    plus.runtime.getProperty(plus.runtime.appid, function (widgetInfo) {
      const data = {
        action: 'checkVersion',
        appid: plus.runtime.appid,
        appVersion: plus.runtime.version,
        wgtVersion: widgetInfo.version
      }
      console.log("data: ", data);
	  uniCloud.callFunction({
	  	name: "check-version",
		data: {
			appid: plus.runtime.appid,
			appVersion: plus.runtime.version,
			wgtVersion: widgetInfo.version
		},
		success: r => {
			console.log(plus.runtime.version, widgetInfo.version, '应用版本信息')
		}
	  })
      // 如果传给java等后端服务，改下方代码
      /* uniCloud.callFunction({
        name: 'uni-upgrade-center',
        data,
        success: (e) => {
          console.log("e: ", e);
          resolve(e)
        },
        fail: (error) => {
          reject(error)
        }
      }) */
    })
  })
  // #endif
  // #ifndef APP-PLUS
  return new Promise((resolve, reject) => {
    reject({
      message: '请在App中使用'
    })
  })
  // #endif
}